package com.hzit.loan.pay.commonApi.enums;

/**
 * 支付状态枚举
 */
public enum PayStatusEnum {

     UN_PAY(1,"未支付"),
     PAY_ING(2,"支付中"),
     FAIL(-1,"支付失败"),
     SUCCESS(0,"支付成功");


    private Integer code;

    private String desc;

    PayStatusEnum(Integer code, String desc){

        this.code = code;
        this.desc = desc;

    }

    /**
     * 根据desc获取code
     * @param desc
     * @return
     */
    public Integer getCode(String desc){

        for ( PayStatusEnum payChannelEnum : PayStatusEnum.values()){

            if(desc.equals(payChannelEnum.getDesc())){
                return payChannelEnum.getCode();
            }
        }

        return null;
    }

    /**
     * 根据code获取desc
     * @param code
     * @return
     */
    public String getDesc(Integer code){

        for ( PayStatusEnum payChannelEnum : PayStatusEnum.values()){

            if(code.equals(payChannelEnum.getCode())){
                return payChannelEnum.getDesc();
            }
        }

        return null;
    }




    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }



}
